#include<iostream>
#include<cstring>
#include<sys/types.h>
#include<sys/stat.h>
#include<fcntl.h>
#include <unistd.h>
using namespace std;

int main()
{
    int fd = open("./tmp.txt",O_WRONLY | O_CREAT);
    const char* str = "i like linux!";
    ssize_t n = write(fd,str,strlen(str));
    close(fd);

    fd = open("./tmp.txt",O_RDONLY);
    char buffer[100];
    read(fd,buffer,sizeof(buffer));
    cout << buffer << endl;
    close(fd);

    return 0;
}